package com.quickfile;

import java.io.IOException;
import java.io.OutputStream;
import java.nio.channels.FileChannel;

public abstract class FileOutputStream extends OutputStream {

	public static FileOutputStream newInstance(String filepath) {
		return FileSystemContext.fileSystemFactory
				.newFileOutputStream(filepath);
	}

	public static FileOutputStream newInstance(String filepath, boolean append) {
		return FileSystemContext.fileSystemFactory.newFileOutputStream(
				filepath, append);
	}

	public static FileOutputStream newInstance(File file) {
		return FileSystemContext.fileSystemFactory.newFileOutputStream(file);
	}

	public static FileOutputStream newInstance(File file, boolean append) {
		return FileSystemContext.fileSystemFactory.newFileOutputStream(file,
				append);
	}

	public abstract void close() throws IOException;

	public abstract FileChannel getChannel();

	public abstract void write(byte[] b) throws IOException;

	public abstract void write(byte[] b, int off, int len) throws IOException;

	public abstract void write(int b) throws IOException;
}
